package tests;

import java.util.Scanner;
//day 43
public class test24 {
    /*//骆驼命名法
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String s = sc.nextLine();
            char[] arr = s.toCharArray();
            for(int i = 0;i < s.length();i++){
                if(arr[i] == '_') {
                    continue;
                }
                if(i > 0 && arr[i-1] == '_'){
                    System.out.print((char)(arr[i]-32));
                }else{
                    System.out.print(arr[i]);
                }
            }
            System.out.println();
        }
    }*/

    //单词倒排
        public static boolean isAlpha(char ch)
        {
            return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z');
        }
        public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        while(s.hasNextLine())
        {
            String str = s.nextLine();
            char[] arr = str.toCharArray();
            for(int i = 0; i < arr.length; ++i)
            {
                if(!isAlpha(arr[i]))
                    arr[i] = ' ';
            }
                str = new String(arr);
            String[] strArr = str.split(" ");
            //去掉首尾的空格
            StringBuilder sb = new StringBuilder();
            for(int i = strArr.length - 1; i >= 0; --i)
                sb.append(strArr[i] + " ");
            System.out.println(sb.toString().trim());
        }
    }
    }
